package com.cloudcreativity.blyg.utils;

import android.app.Dialog;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.databinding.ObservableField;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;

import com.cloudcreativity.blyg.R;
import com.cloudcreativity.blyg.databinding.LayoutDialogInitializeBinding;

public class InitializeDialog extends Dialog {

    public ObservableField<String> result = new ObservableField<>();

    public InitializeDialog(@NonNull Context context) {
        super(context, R.style.myProgressDialogStyle);
        setCancelable(false);
        setCanceledOnTouchOutside(false);
        LayoutDialogInitializeBinding binding = DataBindingUtil.inflate(LayoutInflater.from(context),
                R.layout.layout_dialog_initialize,
                null,
                false);
        setContentView(binding.getRoot());
        assert getWindow()!=null;
        getWindow().getAttributes().width = context.getResources().getDisplayMetrics().widthPixels/2;
        binding.setUtils(this);
    }

    public void setMessage(String msg){
        this.result.set(msg);
    }

}
